Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@google-cloud/logging

Package Overview
Dependencies
Maintainers
1
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/logging

Cloud Logging Client Library for Node.js

  • 10.5.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
590K
decreased by-62.93%
Maintainers
1
Weekly downloads
 
Created

What is @google-cloud/logging?

The @google-cloud/logging package is a client library for Google Cloud Logging, part of Google Cloud's suite of services for storing, searching, analyzing, monitoring, and alerting on log data from Google Cloud and Amazon Web Services. It allows developers to integrate their applications with the Google Cloud Logging service easily, enabling them to send logs directly from their applications to the cloud.

What are @google-cloud/logging's main functionalities?

Writing Log Entries

This feature allows users to write log entries to Google Cloud Logging. The code sample demonstrates how to create a log entry and write it to a specified log in Google Cloud.

const {Logging} = require('@google-cloud/logging');
const logging = new Logging();
const log = logging.log('my-log');
const metadata = {resource: {type: 'global'}};
const entry = log.entry(metadata, {message: 'Hello, world!'});
async function writeLog() {
  await log.write(entry);
  console.log('Logged: Hello, world!');
}
writeLog();

Listing Logs

This feature enables the listing of all logs in the Google Cloud Logging account. The code sample shows how to retrieve and print the names of all logs.

const {Logging} = require('@google-cloud/logging');
const logging = new Logging();
async function listLogs() {
  const [logs] = await logging.getLogs();
  console.log('Logs:');
  logs.forEach(log => {
    console.log(log.name);
  });
}
listLogs();

Deleting Logs

This feature allows users to delete logs from Google Cloud Logging. The code sample illustrates how to delete a specific log by its name.

const {Logging} = require('@google-cloud/logging');
const logging = new Logging();
const log = logging.log('my-log');
async function deleteLog() {
  await log.delete();
  console.log('Log deleted.');
}
deleteLog();

Other packages similar to @google-cloud/logging

Keywords

FAQs

Package last updated on 30 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc